package com.woniuxy.kaer.service.controller;


import cn.hutool.core.bean.BeanUtil;
import com.woniuxy.kaer.commons.util.Result;
import com.woniuxy.kaer.service.from.AddServiceRealFrom;
import com.woniuxy.kaer.service.from.UpdateServiceRealFrom;
import com.woniuxy.kaer.service.param.AddServiceRealParam;
import com.woniuxy.kaer.service.param.UpdateServiceRealParam;
import com.woniuxy.kaer.service.service.ServiceRealService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 程诗洋
 * @since 2025年02月17日
 */
@RestController
@RequestMapping("/serviceReal")
@Api(tags = "订单服务项目类")
public class ServiceRealController {
    @Resource
    private ServiceRealService serviceRealService;
    //第一次记录，预约订单是选择的服务，直接从服务基础中，服务项目中，直接获取,下载预约订单里

    //更改服务项目
    @PostMapping("/updateServiceReal")
    @ApiOperation("订单服务项目更改接口")
    public Result updateServiceReal(@RequestBody UpdateServiceRealFrom from)throws Exception{
        UpdateServiceRealParam updateServiceRealParam = BeanUtil.toBean(from, UpdateServiceRealParam.class);
        serviceRealService.updateServiceReal(updateServiceRealParam);
        return Result.succeed("更新成功",null);
    }
    @PostMapping("/AddServiceReal")
    @ApiOperation("订单服务项目添加接口")
    public Result AddServiceReal(@RequestBody AddServiceRealFrom from)throws Exception{
        AddServiceRealParam addServiceRealParam = BeanUtil.toBean(from, AddServiceRealParam.class);
        serviceRealService.AddServiceReal(addServiceRealParam);
        return Result.succeed("新增订单服务项目成功",null);
    }
}

